package ast_generator;

import java.util.ArrayList;
/**
 * 
 * @author Chu
 *Class for ASTNode, building block of the AST Tree. All methods are really straight forward, consisting of getters and setters.
 */
public class ASTNode {
	private ASTNode left; //left child
	private ASTNode right; //right child
	private ArrayList<String> value; //either contains an arraylist of matchable values (i.e. character/exclude set) or an operation value. Distinguishable by boolean operator
	private boolean operation;//true if this node contains an operation, false if it contains a character/exclude set.

	public ASTNode() {
		left = null;
		right = null;
		value = null;
		operation = false;
	}
	
	public ASTNode(ArrayList<String> value, Boolean operation) {
		left = null;
		right = null;
		this.value = value;
		this.operation = operation;
	}
	
	public ASTNode(ASTNode left, ArrayList<String> value, Boolean operation) {
		this.left = left;
		right = null;
		this.value = value;
		this.operation = operation;
	}
	
	public ASTNode(ArrayList<String> value, ASTNode right, Boolean operation) {
		this.value = value;
		left = null;
		this.right = right;
		this.operation = operation;
	}

	public ASTNode(ASTNode left, ArrayList<String> value, ASTNode right, Boolean operation) {
		this.left = left;
		this.value = value;
		this.right = right;
		this.operation = operation;
	}
	
	public ASTNode getRight() {
		return right;
	}
	
	public void setRight(ASTNode right) {
		this.right = right;
	}
	
	public ASTNode getLeft() {
		return left;
	}
	
	public void setLeft(ASTNode left) {
		this.left = left;
	}
	
	public boolean isOperation() {
		return operation;
	}
	
	public boolean isInput() {
		return !operation;
	}
	
	public void setOperation(boolean operation) {
		this.operation = operation;
	}
	
	public ArrayList<String> getValue() {
		return value;
	}
	
	public void setValue(ArrayList<String> value) {
		this.value = value;
	}
	public String toString()
	{
		return "value: "+value+"operation: "+operation;
	}
}
